package verification

default executables_value = 96

# read value from input.payload
get_payload(key) := v {
    v := object.get(input.payload, key, null)
} else := null

# read value from input.akcert.sce_no_as.payload
get_qta(key) := v {
    v := object.get(input.akcert.sce_no_as.payload, key, null)
} else := null

# export value of itrustee report
export_itrustee_values := {
    "version": get_payload("version"),
    "timestamp": get_payload("timestamp"),
    "scenario": get_payload("scenario"),
    "ta_uuid": get_payload("uuid"),
    "ta_mem": get_payload("ta_mem"),
    "ta_img": get_payload("ta_img"),
    "qta_mem": get_qta("qta_mem"),
    "qta_img": get_qta("qta_img"),
}

# output
annotated_evidence := object.union(
    {
        "log_status": "replay_success",
        "ref_value_match_status": "ignore",
    },
    export_itrustee_values,
)

result := {
    "annotated_evidence": annotated_evidence,
    "ear_trustworthiness_vector": {
        "executables": executables_value,
    },
}